// DlgGripper.cpp : implementation file
//

#include "stdafx.h"
#include "ResizeGripper.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CResizeGripper

CResizeGripper::CResizeGripper()
{
}

CResizeGripper::~CResizeGripper()
{
}


BEGIN_MESSAGE_MAP(CResizeGripper, CScrollBar)
	//{{AFX_MSG_MAP(CResizeGripper)
	ON_WM_NCHITTEST()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CResizeGrippermessage handlers

BOOL CResizeGripper::Create(CWnd *pWndParent)
{
	CRect rect;
	pWndParent->GetClientRect(rect);
	return CScrollBar::Create(SBS_SIZEGRIP|WS_VISIBLE|WS_CHILD|SBS_SIZEBOXBOTTOMRIGHTALIGN, rect, pWndParent, (UINT)-1);
}

UINT CResizeGripper::OnNcHitTest(CPoint point) 
{
	CRect rect;
	GetClientRect(rect);
	ScreenToClient(&point);
	if(point.x < rect.right / 2 && point.y < rect.bottom / 2)
	{
		return (UINT)HTTRANSPARENT;
	}
	
	return HTBOTTOMRIGHT;
}
